import type { TableColumn } from '@/framework/components/core/super-table';

/**
 * 枚举列表
 */
export const dockingPlatform = [
  {
    label: '基点',
    value: 1,
  },
];
export const systemType = [
  {
    label: '作业系统',
    value: 1,
  },
  {
    label: '监控系统',
    value: 2,
  },
];

/**
 * columns
 */
export type TableListItem = {
  id;
  name;
  platform;
  type;
  address;
  quantity;
};
export type TableColumnItem = TableColumn<TableListItem>;

export const baseColumns: TableColumnItem[] = [
  {
    type: 'seq',
    title: '序号',
    width: 60,
  },
  {
    title: '系统名称',
    field: 'name',
  },
  {
    title: '对接平台',
    field: 'platform',
    formatter: ({ cellValue }) => {
      return dockingPlatform.find((item) => item.value === cellValue)?.label ?? '';
    },
    formItemProps: {
      component: 'Select',
      componentProps: {
        options: dockingPlatform,
      },
    },
  },
  {
    title: '系统类型',
    field: 'type',
    formatter: ({ cellValue }) => {
      return systemType.find((item) => item.value === cellValue)?.label ?? '';
    },
    formItemProps: {
      component: 'Select',
      componentProps: {
        options: systemType,
      },
    },
  },
  {
    title: '系统对接地址',
    field: 'address',
    hideInSearch: true,
  },
];
